Computer networks have become ubiquitous. Computer networks include the Internet, Service Provider (SP) networks, enterprise networks, private networks, and Local Area Networks (LANs). A network such as an SP network and enterprise network may include peripherally located Provider Edge (PE) routers, each of which couples to one or multiple Customer Edge (CE) routers. The PE routers are used to maintain routing and forwarding context for each customer. The CE routers may couple to private LANs associated with one or multiple customers. The private LANs are also referred to as core networks. The CE site can be a MAN or WAN as well. The PE routers learn local customer routes from the CE routers and distribute remote customer routes to the CE router. The PEs use Border Gateway Protocol (BGP) to distribute customer routes to each other. To support operation, the PE routers typically maintain Virtual Routing and Forwarding (VRF) information in a table (a VRF table) dictating how to route and forward traffic through the shared physical network to support corresponding Virtual Private Networks (VPNs) for the different customers. For the core network, an ingress PE uses BGP functions to determine the egress PE. For example, the ingress PE puts the packet in a two-level Multi Protocol Label Switching (MPLS) stack. The top label is used to tunnel packets to the egress PE to accomplish MPLS forwarding through the core network. The bottom label is used by the egress PE to identify either the outgoing FIB rewrite adjacency or VRF table for another lookup
In the event of a failure of a device or link that is part of a network, network packets are dropped. In order to overcome this, various techniques are used to determine the location of the failure and to adapt the network to work around the failure. For example, after a failure is detected, the LFIB tables of the various routers may need to be modified to point to corresponding VRFs for lookup and switch back to an alternative PE. This working around the failed device or link may involve waiting for routing to reconverge and possibly directing traffic that normally transits the failed device onto an alternate path until routing (directed forwarding). Directed forwarding may be performed in different ways for different applications.
Conventional Label Distribution Protocol (LDP) operates to create a Label Switching Path (LSP) for a prefix that follows the normally routed path to the prefix. LDP performs local label assignment by assigning a local label L to each prefix. LDP then advertises its local label for a prefix to all of its peers and learns a label from each of its peers for the prefix. LDP installs its local label for a prefix and the label (Lp) learned from the peer selected by routing as next hop for the prefix into MPLS forwarding data structures. This results in a forwarding entry for the prefix LSP of the form of:                L→Lp, int_pWhere L is the local label, Lp is the prefix and label learned from a peer and int_p is the interface. This causes the router to forward labeled packets arriving with top of stack label L by swapping label Lp for L and sending the resulting packet out interface int_p. When routing specifies multiple next hops LDP installs the labels learned from each of the next hops.        
In the conventional backup path selection mechanisms, link state routing protocols and Shortest Path First (SPF) are used to compute the backup path. This provides the backup rewrite as follows:                L→Lb, int_bWhere L is the local label, Lb is the prefix and backup label learned from a peer and int_b is the backup interface. This causes the router to forward labeled packets arriving with top of stack label L by swapping label Lb for L and sending the resulting packet out interface int_b when the primary rewrite        L→Lp, int_pis not available.        